﻿namespace Sitecore.ChangesTracker.Commands
{
  using System;
  using Diagnostics;
  using Shell.Framework.Commands;
  using Sitecore.Web;
  using Web.UI.Sheer;

  public class NextStart : Command
  {
    public override void Execute(CommandContext context)
    {
      Assert.ArgumentNotNull(context, "context");
      //Shell.Applications.WebEdit.WebEditUtil.SetCurrentDate(Shell.Applications.WebEdit.WebEditUtil.GetCurrentDate().AddDays(1));
      DateTime current = WebUtil.GetSessionDateTime("cht_sdate", DateTime.Now.Date).AddDays(1);
      DateTime end = WebUtil.GetSessionDateTime("cht_edate", DateTime.Now.Date);
      if(current>end)
      {
        return;
      }
      WebUtil.SetSessionValue("cht_sdate",current);
      SheerResponse.SetLocation(string.Empty);
    }
  }
}

